/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2015
 */

package com.environment_pro.monitor.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.environment_pro.monitor.util.StaticUtil;

/**
 * @author yangfeng 
 * @version 1.0
 * @since 1.0
 */


public class TbDeviceMsg implements java.io.Serializable{

	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "TbDeviceMsg";
	public static final String ALIAS_ID = "id";
	public static final String ALIAS_MSG_HEAD = "帧头";
	public static final String ALIAS_MSG_LENGTH = "长度";
	public static final String ALIAS_MSG_PROTOCOL_VERSION = "协议版本";
	public static final String ALIAS_MSG_CTRL_CODE = "控制码";
	public static final String ALIAS_MSG_FRAME_TYPE = "帧类别";
	public static final String ALIAS_MSG_TIME_STAMP = "消息时间戳";
	public static final String ALIAS_MSG_SPARE = "保留字段";
	public static final String ALIAS_MSG_SOURCE_ADDRESS = "源地址";
	public static final String ALIAS_MSG_DEST_ADDRESS = "目的地址";
	public static final String ALIAS_MSG_FRAME_CONTENT = "帧内容";
	public static final String ALIAS_MSG_ID = "消息ID";
	public static final String ALIAS_MSG_CHECKSUM = "校验和";
	public static final String ALIAS_ADD_TIME = "入库时间";
	
	
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	private java.lang.Integer id;

	private java.lang.String msgHead;

	private java.lang.Integer msgLength;

	private java.lang.String msgProtocolVersion;

	private java.lang.String msgCtrlCode;

	private java.lang.String msgFrameType;

	private java.lang.String msgTimeStamp;

	private java.lang.String msgSpare;

	private java.lang.String msgSourceAddress;

	private java.lang.String msgDestAddress;

	private java.lang.String msgFrameContent;

	private java.lang.String msgId;

	private java.lang.String msgChecksum;

	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private  java.util.Date addTime;

	//columns END

	//date String
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private java.util.Date addTimeBegin;

	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private java.util.Date addTimeEnd;

	public TbDeviceMsg(){
	}

	public TbDeviceMsg(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setMsgHead(java.lang.String value) {
		this.msgHead = value;
	}
	
	public java.lang.String getMsgHead() {
		return this.msgHead;
	}
	public void setMsgLength(java.lang.Integer value) {
		this.msgLength = value;
	}
	
	public java.lang.Integer getMsgLength() {
		return this.msgLength;
	}
	public void setMsgProtocolVersion(java.lang.String value) {
		this.msgProtocolVersion = value;
	}
	
	public java.lang.String getMsgProtocolVersion() {
		return this.msgProtocolVersion;
	}
	public void setMsgCtrlCode(java.lang.String value) {
		this.msgCtrlCode = value;
	}
	
	public java.lang.String getMsgCtrlCode() {
		return this.msgCtrlCode;
	}
	public void setMsgFrameType(java.lang.String value) {
		this.msgFrameType = value;
	}
	
	public java.lang.String getMsgFrameType() {
		return this.msgFrameType;
	}
	public void setMsgTimeStamp(java.lang.String value) {
		this.msgTimeStamp = value;
	}
	
	public java.lang.String getMsgTimeStamp() {
		return this.msgTimeStamp;
	}
	public void setMsgSpare(java.lang.String value) {
		this.msgSpare = value;
	}
	
	public java.lang.String getMsgSpare() {
		return this.msgSpare;
	}
	public void setMsgSourceAddress(java.lang.String value) {
		this.msgSourceAddress = value;
	}
	
	public java.lang.String getMsgSourceAddress() {
		return this.msgSourceAddress;
	}
	public void setMsgDestAddress(java.lang.String value) {
		this.msgDestAddress = value;
	}
	
	public java.lang.String getMsgDestAddress() {
		return this.msgDestAddress;
	}
	public void setMsgFrameContent(java.lang.String value) {
		this.msgFrameContent = value;
	}
	
	public java.lang.String getMsgFrameContent() {
		return this.msgFrameContent;
	}
	public void setMsgId(java.lang.String value) {
		this.msgId = value;
	}
	
	public java.lang.String getMsgId() {
		return this.msgId;
	}
	public void setMsgChecksum(java.lang.String value) {
		this.msgChecksum = value;
	}
	
	public java.lang.String getMsgChecksum() {
		return this.msgChecksum;
	}

	public void setAddTimeBegin(java.util.Date value) {
		this.addTimeBegin = value;
	}
	
	public java.util.Date getAddTimeBegin() {
		return this.addTimeBegin;
	}

	public void setAddTimeEnd(java.util.Date value) {
		this.addTimeEnd = value;
	}
	
	public java.util.Date getAddTimeEnd() {
		return this.addTimeEnd;
	}
	
	public void setAddTime(java.util.Date value) {
		this.addTime = value;
	}
	
	public java.util.Date getAddTime() {
		return this.addTime;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("MsgHead",getMsgHead())
			.append("MsgLength",getMsgLength())
			.append("MsgProtocolVersion",getMsgProtocolVersion())
			.append("MsgCtrlCode",getMsgCtrlCode())
			.append("MsgFrameType",getMsgFrameType())
			.append("MsgTimeStamp",getMsgTimeStamp())
			.append("MsgSpare",getMsgSpare())
			.append("MsgSourceAddress",getMsgSourceAddress())
			.append("MsgDestAddress",getMsgDestAddress())
			.append("MsgFrameContent",getMsgFrameContent())
			.append("MsgId",getMsgId())
			.append("MsgChecksum",getMsgChecksum())
			.append("AddTime",getAddTime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof TbDeviceMsg == false) return false;
		if(this == obj) return true;
		TbDeviceMsg other = (TbDeviceMsg)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

